Incorrect $_SERVER["SERVER_PORT"] Returned

Incorrect $_SERVER["SERVER_PORT"] Returned

am 16.10.2009 19:05:47 von Bob Schell

--00032557b1623e2b240476106838
Content-Type: text/plain; charset=ISO-8859-1

Hello. I have configured my RHEL5 Apache system with SSL. I verified that
SSL was installed correctly and accessing the site via SSL works as expected
with the one exception described below.

The problem I am having is my PHP code is pulling the
$_SERVER['SERVER_PORT'] variable and this is coming back as 80 rather than
443. To narrow this problem down, I've closed port 80 by commenting out
'LISTEN 80' so my server is ONLY listening on port 443. I've verified this
via a port scan of my server ... 443 is open, 80 is not.

Here is my code within HTTPD.CONF


NameVirtualHost *:443

:

:

:



ServerAdmin first.name@xyz.com

DocumentRoot /var/www/html/redcap

ServerName name.url.edu

ErrorLog logs/

CustomLog logs/


I can get 443 to be returned from _SERVER['SERVER_PORT'] if I edit the 3rd
line above to :

ServerName name.url.edu:443

But, if I do this, it messes a few other things up internal to the site.

Does anyone have an idea why _SERVER['SERVER_PORT'] is returning 80 rather
than 443?

Any thoughts would be much appreciated.

Regards,

--00032557b1623e2b240476106838
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello.=A0 I have configured my RHEL5 Apache system with SSL.=A0 I
verified that SSL was installed correctly and accessing the site via
SSL works as expected with the one exception described below.

=A0

The problem I am having is my PHP code is pulling the
$_SERVER['SERVER_PORT'] variable and this is coming back as 80 rath=
er
than 443.=A0 To narrow this problem down, I've closed port 80 by commen=
ting out 'LISTEN 80' so my server is ONLY listening on port 443.=A0=
I've verified this via a port scan of my server ... 443 is open, 80 is=
not.


=A0

Here is my <VIRTUALHOST> code within HTTPD.CONF

=A0

ize: 11pt; color: rgb(31, 73, 125);">NameVirtualHost *:443

ss=3D"MsoNormal" style=3D"margin: 0in 0in 0pt;"> 1pt; color: rgb(31, 73, 125);">:


ize: 11pt; color: rgb(31, 73, 125);">:

le=3D"margin: 0in 0in 0pt;"> 73, 125);">:

e=3D"font-size: 11pt; color: rgb(31, 73, 125);"><VirtualHost *:443> span>


ize: 11pt; color: rgb(31, 73, 125);">ServerAdmin me@xyz.com" target=3D"_blank">first.name@xyz.com



ize: 11pt; color: rgb(31, 73, 125);">DocumentRoot /var/www/html/redcap n>


ize: 11pt; color: rgb(31, 73, 125);">ServerName edu/" target=3D"_blank">name.url.edu


ize: 11pt; color: rgb(31, 73, 125);">ErrorLog logs/<filename><=
/p>

ize: 11pt; color: rgb(31, 73, 125);">CustomLog logs/<filename>=


-size: 11pt; color: rgb(31, 73, 125);"></VirtualHost>

-size: 11pt; color: rgb(31, 73, 125);">=A0

-size: 11pt; color: rgb(31, 73, 125);">I can get 44=
3 to be returned from _SERVER['SERVER_PORT'] if I edit the=A03rd li=
ne above to :



-size: 11pt; color: rgb(31, 73, 125);">=A0

-size: 11pt; color: rgb(31, 73, 125);">ServerName l.edu:443/" target=3D"_blank">name.url.edu:443


-size: 11pt; color: rgb(31, 73, 125);">=A0

-size: 11pt; color: rgb(31, 73, 125);">But, if I do=
this, it messes a few other things up internal to the site.
<=
/div>


-size: 11pt; color: rgb(31, 73, 125);">=A0

-size: 11pt; color: rgb(31, 73, 125);">Does anyone =
have an idea why _SERVER['SERVER_PORT'] is returning 80 rather than=
443?



-size: 11pt; color: rgb(31, 73, 125);">=A0

-size: 11pt; color: rgb(31, 73, 125);">Any thoughts=
would be much appreciated.


-size: 11pt; color: rgb(31, 73, 125);">=A0

-size: 11pt; color: rgb(31, 73, 125);">Regards, nt>


--00032557b1623e2b240476106838--

Re: Incorrect $_SERVER["SERVER_PORT"] Returned

am 16.10.2009 19:12:53 von Eric Covener

On Fri, Oct 16, 2009 at 1:05 PM, Bob Schell wrote:
> The problem I am having is my PHP code is pulling the
> $_SERVER['SERVER_PORT'] variable and this is coming back as 80 rather tha=
n
> 443.=A0 To narrow this problem down, I've closed port 80 by commenting ou=
t
> 'LISTEN 80' so my server is ONLY listening on port 443.=A0 I've verified =
this
> via a port scan of my server ... 443 is open, 80 is not.

There was a thread about this today on this very list, have you tried
the solution there?

http://marc.info/?l=3Dapache-httpd-users&m=3D125569605710861 &w=3D2

--=20
Eric Covener
covener@gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Incorrect $_SERVER["SERVER_PORT"] Returned

am 16.10.2009 19:48:15 von Bob Schell

--002354790ac01c590404761100e7
Content-Type: text/plain; charset=ISO-8859-1

Thanks for the quick response Eric. Well, if I add :

'UseCanonicalPhysicalPort On'

I can then keep my 3rd line within be :

ServerName name.url.edu (without the :443)

And I DO get the proper port returned.

However, then, within the application I am using, if I logout of the
application and/or navigate around as I used to be able to do, I get the
following URL which errors out on me:

http://name.url.edu:443/rcsurvey/rp_survey/1.3.1/

You can see that it tacked on the ':443' and changed https to http.

Any thoughts?


On Fri, Oct 16, 2009 at 11:12 AM, Eric Covener wrote:

> On Fri, Oct 16, 2009 at 1:05 PM, Bob Schell wrote:
> > The problem I am having is my PHP code is pulling the
> > $_SERVER['SERVER_PORT'] variable and this is coming back as 80 rather
> than
> > 443. To narrow this problem down, I've closed port 80 by commenting out
> > 'LISTEN 80' so my server is ONLY listening on port 443. I've verified
> this
> > via a port scan of my server ... 443 is open, 80 is not.
>
> There was a thread about this today on this very list, have you tried
> the solution there?
>
> http://marc.info/?l=apache-httpd-users&m=125569605710861&w=2
>
> --
> Eric Covener
> covener@gmail.com
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--002354790ac01c590404761100e7
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks for the quick response Eric.=A0 Well, if I add :

'UseCano=
nicalPhysicalPort On'

I can then keep my 3rd line within <vir=
tualhost *:443> be :

ServerName n=
ame.url.edu
(without the :443)


And I DO get the proper port returned.

However, then, within the=
application I am using, if I logout of the application and/or navigate aro=
und as I used to be able to do, I get the following URL which errors out on=
me:


http://na=
me.url.edu:443/rcsurvey/rp_survey/1.3.1/


You can see that it tac=
ked on the ':443' and changed https to http.

Any thoughts? r>


On Fri, Oct 16, 2009 at 11:12 AM, Eric C=
ovener < "_blank">covener@gmail.com> wrote:

204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Fri, Oct =
16, 2009 at 1:05 PM, Bob Schell < target=3D"_blank">schellb12@gmail.com> wrote:



> The problem I am having is my PHP code is pulling the

> $_SERVER['SERVER_PORT'] variable and this is coming back as 80=
rather than

> 443.=A0 To narrow this problem down, I've closed port 80 by commen=
ting out

> 'LISTEN 80' so my server is ONLY listening on port 443.=A0 I&#=
39;ve verified this

> via a port scan of my server ... 443 is open, 80 is not.



There was a thread about this today on this very list, have you tried=


the solution there?



&w=3D2" target=3D"_blank">http://marc.info/?l=3Dapache-httpd-users&a mp;=
m=3D125569605710861&w=3D2




--

Eric Covener

covener@gmail.com >



------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL:
lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g" target=3D"_blank">users-unsubscribe@httpd.apache.org

=A0 " =A0 from the digest: @httpd.apache.org" target=3D"_blank">users-digest-unsubscribe@httpd.apache.=
org


For additional commands, e-mail: org" target=3D"_blank">users-help@httpd.apache.org






--002354790ac01c590404761100e7--

Re: Incorrect $_SERVER["SERVER_PORT"] Returned

am 16.10.2009 19:51:40 von Eric Covener

On Fri, Oct 16, 2009 at 1:48 PM, Bob Schell wrote:
> However, then, within the application I am using, if I logout of the
> application and/or navigate around as I used to be able to do, I get the
> following URL which errors out on me:
>
> http://name.url.edu:443/rcsurvey/rp_survey/1.3.1/
>
> You can see that it tacked on the ':443' and changed https to http.

Your config also implied http over 443 which is unusual. A redirect
to that protocol and port seems pretty natural.

--
Eric Covener
covener@gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Incorrect $_SERVER["SERVER_PORT"] Returned

am 16.10.2009 20:02:21 von Bob Schell

--00032557b16293514c0476113220
Content-Type: text/plain; charset=ISO-8859-1

Thanks again for the quick reply. How did my config also imply http over
443?

On Fri, Oct 16, 2009 at 11:51 AM, Eric Covener wrote:

> On Fri, Oct 16, 2009 at 1:48 PM, Bob Schell wrote:
> > However, then, within the application I am using, if I logout of the
> > application and/or navigate around as I used to be able to do, I get the
> > following URL which errors out on me:
> >
> > http://name.url.edu:443/rcsurvey/rp_survey/1.3.1/
> >
> > You can see that it tacked on the ':443' and changed https to http.
>
> Your config also implied http over 443 which is unusual. A redirect
> to that protocol and port seems pretty natural.
>
> --
> Eric Covener
> covener@gmail.com
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--00032557b16293514c0476113220
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks again for the quick reply.=A0 How did my config also imply http over=
443?

On Fri, Oct 16, 2009 at 11:51 AM, E=
ric Covener <cove=
ner@gmail.com
>
wrote:

204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
>On Fri, Oct 16, 2009 at 1:48 PM, Bob Schell < 2@gmail.com">schellb12@gmail.com> wrote:


> However, then, within the application I am using, if I logout of the r>
> application and/or navigate around as I used to be able to do, I get t=
he

> following URL which errors out on me:

>

> =3D"_blank">http://name.url.edu:443/rcsurvey/rp_survey/1.3.1 /

>

> You can see that it tacked on the ':443' and changed https to =
http.



Your config also implied http over 443 which is unusual. =A0A redirec=
t

to that protocol and port seems pretty natural.



--

Eric Covener





------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL: lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g">users-unsubscribe@httpd.apache.org

=A0 " =A0 from the digest: @httpd.apache.org">users-digest-unsubscribe@httpd.apache.org

For additional commands, e-mail: org">users-help@httpd.apache.org






--00032557b16293514c0476113220--

Re: Incorrect $_SERVER["SERVER_PORT"] Returned

am 16.10.2009 20:16:47 von Eric Covener

On Fri, Oct 16, 2009 at 2:02 PM, Bob Schell wrote:
> Thanks again for the quick reply.=A0 How did my config also imply http ov=
er
> 443?
>
> On Fri, Oct 16, 2009 at 11:51 AM, Eric Covener wrote:
>>
>> On Fri, Oct 16, 2009 at 1:48 PM, Bob Schell wrote:
>> > However, then, within the application I am using, if I logout of the
>> > application and/or navigate around as I used to be able to do, I get t=
he
>> > following URL which errors out on me:
>> >
>> > http://name.url.edu:443/rcsurvey/rp_survey/1.3.1/
>> >
>> > You can see that it tacked on the ':443' and changed https to http.
>>
>> Your config also implied http over 443 which is unusual. =A0A redirect
>> to that protocol and port seems pretty natural.

Normally an SSL virtual host has SSL directives in it.

--=20
Eric Covener
covener@gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Incorrect $_SERVER["SERVER_PORT"] Returned

am 16.10.2009 23:11:21 von Bob Schell

--0016364c6509734db7047613d6d5
Content-Type: text/plain; charset=ISO-8859-1

Thanks again Eric. Once I moved the SSL virtual host within SSL.CONF, that
did the trick and everything worked as expected.

Much appreciated.

On Fri, Oct 16, 2009 at 12:16 PM, Eric Covener wrote:

> On Fri, Oct 16, 2009 at 2:02 PM, Bob Schell wrote:
> > Thanks again for the quick reply. How did my config also imply http over
> > 443?
> >
> > On Fri, Oct 16, 2009 at 11:51 AM, Eric Covener
> wrote:
> >>
> >> On Fri, Oct 16, 2009 at 1:48 PM, Bob Schell
> wrote:
> >> > However, then, within the application I am using, if I logout of the
> >> > application and/or navigate around as I used to be able to do, I get
> the
> >> > following URL which errors out on me:
> >> >
> >> > http://name.url.edu:443/rcsurvey/rp_survey/1.3.1/
> >> >
> >> > You can see that it tacked on the ':443' and changed https to http.
> >>
> >> Your config also implied http over 443 which is unusual. A redirect
> >> to that protocol and port seems pretty natural.
>
> Normally an SSL virtual host has SSL directives in it.
>
> --
> Eric Covener
> covener@gmail.com
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--0016364c6509734db7047613d6d5
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks again Eric.=A0 Once I moved the SSL virtual host within SSL.CONF, th=
at did the trick and everything worked as expected.

Much appreciated=
..

On Fri, Oct 16, 2009 at 12:16 PM, Eric =
Covener <covener@=
gmail.com
>
wrote:

204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
>On Fri, Oct 16, 2009 at 2:02 PM, Bob Schell < 2@gmail.com">schellb12@gmail.com> wrote:


> Thanks again for the quick reply.=A0 How did my config also imply http=
over

> 443?

>

> On Fri, Oct 16, 2009 at 11:51 AM, Eric Covener < ovener@gmail.com">covener@gmail.com> wrote:

>>

>> On Fri, Oct 16, 2009 at 1:48 PM, Bob Schell < schellb12@gmail.com">schellb12@gmail.com> wrote:

>> > However, then, within the application I am using, if I logout=
of the

>> > application and/or navigate around as I used to be able to do=
, I get the

>> > following URL which errors out on me:

>> >

>> > target=3D"_blank">http://name.url.edu:443/rcsurvey/rp_survey /1.3.1/ >
>> >

>> > You can see that it tacked on the ':443' and changed =
https to http.

>>

>> Your config also implied http over 443 which is unusual. =A0A redi=
rect

>> to that protocol and port seems pretty natural.



Normally an SSL virtual host has SSL directives in it.



--

Eric Covener





------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL: lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g">users-unsubscribe@httpd.apache.org

=A0 " =A0 from the digest: @httpd.apache.org">users-digest-unsubscribe@httpd.apache.org

For additional commands, e-mail: org">users-help@httpd.apache.org






--0016364c6509734db7047613d6d5--